package com.hcs.hojbackendjudgeservice.judge.codeSandBox;

import com.hcs.hojbackendmodel.model.codesandbox.ExecuteCodeRequest;
import com.hcs.hojbackendmodel.model.codesandbox.ExecuteCodeResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * 代码沙箱代理类（日志增强）
 */
@Slf4j
public class CodeSandBoxProxy implements CodeSandBox{

    private CodeSandBox codeSandBox;

    public CodeSandBoxProxy (CodeSandBox codeSandBox) {
        this.codeSandBox = codeSandBox;
    };

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        log.info("代码沙箱请求信息：" + executeCodeRequest.toString());
        ExecuteCodeResponse executeCodeResponse = codeSandBox.executeCode(executeCodeRequest);
        log.info("代码沙箱响应信息：" + executeCodeResponse.toString());
        return executeCodeResponse;
    }
}
